package com.cn.wanxi.autoconfig.vo;

import lombok.Data;

/**
 * @ClassName ResultVO
 * @Description TODO
 * @Author JiJiang
 * @Date 2023/7/5 23:06
 * @Version 1.0
 */

@Data
public class ResultVO<T> {


    private Integer code;

    private String msg;


    private Integer count;


    private T data;


    public static <M> ResultVO<M> getResult(Integer code, String msg, Integer count, M data) {

        ResultVO<M> ret = new ResultVO<>();
        ret.setCode(code);
        ret.setCount(count);
        ret.setMsg(msg);
        ret.setData(data);
        return ret;

    }


    public static ResultVO<Object> getResultOnlyMsg(String msg) {
        return getResult(0, msg, 0, null);
    }

    public static <M> ResultVO<M> getResult(String msg, M data) {
        return getResult(0, msg, 0, data);
    }

}
